import math
print "Chapter 4 Exercises"
print int(math.fabs(-4.3))
print math.ceil(math.sin(34.5))

import calendar
def whichNextLeap(year):
	l = False
	while not l:
		l = calendar.isleap(year)
		year+=1
	return year
		
print "whichNextLeap(2010):",whichNextLeap(2010)

def howmany():
	count = 0
	for i in range(2000,2050):
		if calendar.isleap(i):
			count+=1 
	return count

print "howmany():",howmany()

s = "Boolean"
print s.capitalize()

c = "C02 H20"
print c[2]

for i in range(len(c)):
	if c[i] == "2":
	   print '"2" found at c[',i,']'
	   
if s[0].islower():print s, "begins with a lowercase letter"
else:print s, "does not begin with a lowercase letter"
	
m=" MoNDaY"
print m.lstrip().lower().capitalize()

def double_p(values):
	if values == []:
		pass # Do nothing to the empty list
	else:
		temp = values[0]
		print 'temp = %s'%temp
		values[0] = 0
		for i in range(1,len(values)):
			print 'temp = %s: values[i] = %s'%(temp,values[i])
			temp = values[i]
			values[i] = 2*temp
			
	return values

print double_p([1,2,3,7,14,2,9])